﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Management;
using System.Text;
using WMI.NET.CIM;
using WMI.NET.Abstracts;

namespace WMI.NET.ComputerSystemHardware.MotherboardControllerPort
{
    /// <summary>
    /// The Win32_USBController WMI class manages the capabilities of a universal serial bus (USB) controller.
    /// </summary>
    public class Win32_USBController : CIM_USBController
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="mbo"></param>
        public Win32_USBController(ManagementBaseObject mbo)
            : base(mbo)
        {

        }

    }

    /// <summary>
    /// 
    /// </summary>
    public class GetWin32_USBControllers : Win32Collection<Win32_USBController>
    {

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override ReadOnlyCollection<Win32_USBController> GetCollection()
        {
            List<Win32_USBController> tempCollection = new List<Win32_USBController>();

            foreach (var s in searcher.Get())
            {
                Win32_USBController tempListItem = new Win32_USBController(s);
                tempCollection.Add(tempListItem);
            }

            return tempCollection.AsReadOnly();
        }

        /// <summary>
        /// 
        /// </summary>
        public GetWin32_USBControllers() : base("SELECT * FROM Win32_USBController"){}
        
    }
}
